package org.example.basic.lambda.stream;


import org.example.basic.entity.UserEntity;
import org.example.basic.entity.UserEntityList;

import java.util.List;

/**
 * toArray 案例
 * @author songyafei
 */
public class LambdaToArray {

    public static void main(String[] args) {
        List<UserEntity> l1 = UserEntityList.getList();
        Object[] objects = l1.stream().limit(10).toArray();
        Object[] o1 = l1.stream().limit(10).toArray(Object[]::new);
        for (Object object : objects) {
            System.out.println(object);
        }


        System.out.println("------------------------");
        for (Object o : o1) {
            System.out.println(o);
        }
    }
}
